import { SAVE_USER, SAVE_PROFILE } from '@/store/constance'

// 初始值
const initVal = {
  user: {},
  profile: {},
}
const profile = (state = initVal, action) => {
  const { type, payload } = action
  switch (type) {
    case SAVE_USER:
      return { ...state, user: payload }
    case SAVE_PROFILE:
      return { ...state, profile: payload }
    default:
      return state
  }
}

export default profile
